<!doctype html>
<html class="default no-js">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>@aws/dynamodb-expressions</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="assets/css/main.css">
</head>
<body>
<header>
	<div class="tsd-page-toolbar">
		<div class="container">
			<div class="table-wrap">
				<div class="table-cell" id="tsd-search" data-index="assets/js/search.js" data-base=".">
					<div class="field">
						<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
						<input id="tsd-search-field" type="text" />
					</div>
					<ul class="results">
						<li class="state loading">Preparing search index...</li>
						<li class="state failure">The search index is not available</li>
					</ul>
					<a href="index.html" class="title">@aws/dynamodb-expressions</a>
				</div>
				<div class="table-cell" id="tsd-widgets">
					<div id="tsd-filter">
						<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
						<div class="tsd-filter-group">
							<div class="tsd-select" id="tsd-filter-visibility">
								<span class="tsd-select-label">All</span>
								<ul class="tsd-select-list">
									<li data-value="public">Public</li>
									<li data-value="protected">Public/Protected</li>
									<li data-value="private" class="selected">All</li>
								</ul>
							</div>
							<input type="checkbox" id="tsd-filter-inherited" checked />
							<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
							<input type="checkbox" id="tsd-filter-externals" checked />
							<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
						</div>
					</div>
					<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
				</div>
			</div>
		</div>
	</div>
	<div class="tsd-page-title">
		<div class="container">
			<ul class="tsd-breadcrumb">
				<li>
					<a href="globals.html">Globals</a>
				</li>
			</ul>
			<h1> @aws/dynamodb-expressions</h1>
		</div>
	</div>
</header>
<div class="container container-main">
	<div class="row">
		<div class="col-8 col-content">
			<div class="tsd-panel tsd-typography">
				<h1 id="amazon-dynamodb-expressions">Amazon DynamoDB Expressions</h1>
				<p><a href="http://aws.amazon.com/apache-2-0/"><img src="https://img.shields.io/github/license/awslabs/dynamodb-data-mapper-js.svg?style=flat" alt="Apache 2 License"></a></p>
				<p>This library provides a number of abstractions designed to make dealing with
				Amazon DynamoDB expressions easier and more natural for JavaScript developers.</p>
				<h2 id="attribute-paths">Attribute paths</h2>
				<p>The <code>AttributePath</code> class provides a simple way to write <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Attributes.html#Expressions.Attributes.NestedElements.DocumentPathExamples">DynamoDB document
					paths</a>.
					If the constructor receives a string, it will parse the path by scanning for
					dots (<code>.</code>), which designate map property dereferencing and left brackets (<code>[</code>),
					which designate list attribute dereferencing. For example,
					<code>&#39;ProductReviews.FiveStar[0].reviewer.username&#39;</code> would be understood as
					referring to the <code>username</code> property of the <code>reviewer</code> property of the first
					element of the list stored at the <code>FiveStar</code> property of the top-level
				<code>ProductReviews</code> document attribute.</p>
				<p>If a property name contains a left bracket or dot, it may be escaped with a
					backslash <code>\</code>. For example, <code>Product\.Reviews</code> would be interpreted as a single
				top-level document attribute rather than as a map property access.</p>
				<h2 id="attribute-values">Attribute values</h2>
				<p>This library will marshall values encountered using runtime type detection. If
					you have a value that is already in the format expected by DynamoDB, you may
					pass it to the <code>AttributeValue</code> constructor to direct other expression helpers
				not to marshall the value further.</p>
				<h2 id="condition-expressions">Condition expressions</h2>
				<p>DynamoDB condition expressions may come in the form of a function call or as the
					combination of values and infix operators. This library therefore defines a
					<code>ConditionExpression</code> as the union of <a href="#function-expressions"><code>FunctionExpression</code></a>
					and a tagged union of the expression operator types. Expressions may be compound
				or simple.</p>
				<h3 id="compound-expressions">Compound expressions</h3>
				<p>These expressions envelope one or more simple expressions and are true or false
					based on the value of the subexpressions they contain. The recognized compound
				expressions are:</p>
				<h4 id="and-expressions"><code>And</code> expressions</h4>
				<p>Asserts that all of the subexpressions&#39; conditions are satisfied.</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {ConditionExpression} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">const</span> andExpression: ConditionExpression = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'And'</span>,
    conditions: [
        <span class="hljs-comment">// one or more subexpressions</span>
    ]
};
</code></pre>
				<h4 id="or-expressions"><code>Or</code> expressions</h4>
				<p>Asserts that at least one of the subexpressions&#39; conditions are satisfied.</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {ConditionExpression} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">const</span> orExpression: ConditionExpression = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'Or'</span>,
    conditions: [
        <span class="hljs-comment">// one or more subexpressions</span>
    ]
};
</code></pre>
				<h4 id="not-expressions"><code>Not</code> expressions</h4>
				<p>Asserts that the subexpression&#39;s condition is not satisfied.</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {ConditionExpression} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">const</span> notExpression: ConditionExpression = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'Not'</span>,
    condition: {
        <span class="hljs-keyword">type</span>: <span class="hljs-string">'LessThan'</span>,
        subject: <span class="hljs-string">'foo'</span>,
        object: <span class="hljs-number">100</span>
    }
};
</code></pre>
				<h3 id="simple-expressions">Simple expressions</h3>
				<p>These expressions make an assertion about a property in a DynamoDB object known
					as the expression&#39;s <code>subject</code>. The <code>subject</code> must be a string or an <a href="#attribute-paths">attribute
				path</a>.</p>
				<p>The particular assertion used is referred to in this library as a
					<code>ConditionExpressionPredicate</code>. A predicate may be declared separately from its
					<code>subject</code> but only becomes a valid expression when paired with a <code>subject</code>. The
				supported condition expression predicates are:</p>
				<h4 id="equals-expression-predicate"><code>Equals</code> expression predicate</h4>
				<p>Creates a condition which is true if the defined <code>subject</code> is equal to the
					defined <code>object</code>. For example, the following predicate object asserts that the
				subject has a value of <code>&#39;bar&#39;</code>:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    ConditionExpression,
    ConditionExpressionPredicate,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">let</span> equalsExpressionPredicate: ConditionExpressionPredicate = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'Equals'</span>,
    object: <span class="hljs-string">'bar'</span>
};

<span class="hljs-comment">// you can also define an equality predicate with the `equals` helper method</span>
<span class="hljs-keyword">import</span> {equals} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

equalsExpressionPredicate = equals(<span class="hljs-string">'bar'</span>);

<span class="hljs-comment">// combine with a subject to create a valid condition expression</span>
<span class="hljs-keyword">const</span> equalsExpression: ConditionExpression = {
    ...equalsExpressionPredicate,
    subject: <span class="hljs-string">'foo'</span>
};
</code></pre>
				<p><code>object</code> may be an <a href="#attribute-paths">attribute path</a>, an <a href="#attribute-values">attribute
					value</a>, or another type. If the lattermost type is received,
				it will be serialized using the <code>@aws/dynamodb-auto-marshaller</code> package.</p>
				<h4 id="notequals-expression-predicate"><code>NotEquals</code> expression predicate</h4>
				<p>Creates a condition which is true if the defined <code>subject</code> is NOT equal to the
					defined <code>object</code>. For example, the following predicate object asserts that the
				subject does not have a value of <code>&#39;bar&#39;</code>:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    ConditionExpression,
    ConditionExpressionPredicate,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">let</span> equalsExpressionPredicate: ConditionExpressionPredicate = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'NotEquals'</span>,
    object: <span class="hljs-string">'bar'</span>
};

<span class="hljs-comment">// you can also define an equality predicate with the `equals` helper method</span>
<span class="hljs-keyword">import</span> {notEquals} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

equalsExpressionPredicate = notEquals(<span class="hljs-string">'bar'</span>);

<span class="hljs-comment">// combine with a subject to create a valid condition expression</span>
<span class="hljs-keyword">const</span> equalsExpression: ConditionExpression = {
    ...equalsExpressionPredicate,
    subject: <span class="hljs-string">'foo'</span>
};
</code></pre>
				<p><code>object</code> may be an <a href="#attribute-paths">attribute path</a>, an <a href="#attribute-values">attribute
					value</a>, or another type. If the lattermost type is received,
				it will be serialized using the <code>@aws/dynamodb-auto-marshaller</code> package.</p>
				<h4 id="lessthan-expression-predicate"><code>LessThan</code> expression predicate</h4>
				<p>Creates a condition which is true if the defined <code>subject</code> is less than the
					defined <code>object</code>. For example, the following predicate object asserts that the
				subject is less than 10:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    ConditionExpression,
    ConditionExpressionPredicate,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">let</span> equalsExpressionPredicate: ConditionExpressionPredicate = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'LessThan'</span>,
    object: <span class="hljs-number">10</span>
};

<span class="hljs-comment">// you can also define an equality predicate with the `equals` helper method</span>
<span class="hljs-keyword">import</span> {lessThan} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

equalsExpressionPredicate = lessThan(<span class="hljs-number">10</span>);

<span class="hljs-comment">// combine with a subject to create a valid condition expression</span>
<span class="hljs-keyword">const</span> equalsExpression: ConditionExpression = {
    ...equalsExpressionPredicate,
    subject: <span class="hljs-string">'foo'</span>
};
</code></pre>
				<p><code>object</code> may be an <a href="#attribute-paths">attribute path</a>, an <a href="#attribute-values">attribute
					value</a>, or another type. If the lattermost type is received,
				it will be serialized using the <code>@aws/dynamodb-auto-marshaller</code> package.</p>
				<h4 id="lessthanorequalto-expression-predicate"><code>LessThanOrEqualTo</code> expression predicate</h4>
				<p>Creates a condition which is true if the defined <code>subject</code> is less than or equal
					to the defined <code>object</code>. For example, the following predicate object asserts
				that the subject is less than or equal to 10:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    ConditionExpression,
    ConditionExpressionPredicate,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">let</span> equalsExpressionPredicate: ConditionExpressionPredicate = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'LessThanOrEqualTo'</span>,
    object: <span class="hljs-number">10</span>
};

<span class="hljs-comment">// you can also define an equality predicate with the `equals` helper method</span>
<span class="hljs-keyword">import</span> {lessThanOrEqualTo} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

equalsExpressionPredicate = lessThanOrEqualTo(<span class="hljs-number">10</span>);

<span class="hljs-comment">// combine with a subject to create a valid condition expression</span>
<span class="hljs-keyword">const</span> equalsExpression: ConditionExpression = {
    ...equalsExpressionPredicate,
    subject: <span class="hljs-string">'foo'</span>
};
</code></pre>
				<p><code>object</code> may be an <a href="#attribute-paths">attribute path</a>, an <a href="#attribute-values">attribute
					value</a>, or another type. If the lattermost type is received,
				it will be serialized using the <code>@aws/dynamodb-auto-marshaller</code> package.</p>
				<h4 id="greaterthan-expression-predicate"><code>GreaterThan</code> expression predicate</h4>
				<p>Creates a condition which is true if the defined <code>subject</code> is greater than the
					defined <code>object</code>. For example, the following predicate object asserts that the
				subject is greater than 10:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    ConditionExpression,
    ConditionExpressionPredicate,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">let</span> equalsExpressionPredicate: ConditionExpressionPredicate = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'GreaterThan'</span>,
    object: <span class="hljs-number">10</span>
};

<span class="hljs-comment">// you can also define an equality predicate with the `equals` helper method</span>
<span class="hljs-keyword">import</span> {greaterThan} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

equalsExpressionPredicate = greaterThan(<span class="hljs-number">10</span>);

<span class="hljs-comment">// combine with a subject to create a valid condition expression</span>
<span class="hljs-keyword">const</span> equalsExpression: ConditionExpression = {
    ...equalsExpressionPredicate,
    subject: <span class="hljs-string">'foo'</span>
};
</code></pre>
				<p><code>object</code> may be an <a href="#attribute-paths">attribute path</a>, an <a href="#attribute-values">attribute
					value</a>, or another type. If the lattermost type is received,
				it will be serialized using the <code>@aws/dynamodb-auto-marshaller</code> package.</p>
				<h4 id="greaterthanorequalto-expression-predicate"><code>GreaterThanOrEqualTo</code> expression predicate</h4>
				<p>Creates a condition which is true if the defined <code>subject</code> is greater than or
					equal to the defined <code>object</code>. For example, the following predicate object
				asserts that the subject is greater than or equal to 10:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    ConditionExpression,
    ConditionExpressionPredicate,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">let</span> equalsExpressionPredicate: ConditionExpressionPredicate = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'GreaterThanOrEqualTo'</span>,
    object: <span class="hljs-number">10</span>
};

<span class="hljs-comment">// you can also define an equality predicate with the `equals` helper method</span>
<span class="hljs-keyword">import</span> {greaterThanOrEqualTo} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

equalsExpressionPredicate = greaterThanOrEqualTo(<span class="hljs-number">10</span>);

<span class="hljs-comment">// combine with a subject to create a valid condition expression</span>
<span class="hljs-keyword">const</span> equalsExpression: ConditionExpression = {
    ...equalsExpressionPredicate,
    subject: <span class="hljs-string">'foo'</span>
};
</code></pre>
				<p><code>object</code> may be an <a href="#attribute-paths">attribute path</a>, an <a href="#attribute-values">attribute
					value</a>, or another type. If the lattermost type is received,
				it will be serialized using the <code>@aws/dynamodb-auto-marshaller</code> package.</p>
				<h4 id="between-expression-predicate"><code>Between</code> expression predicate</h4>
				<p>Creates a condition which is true if the defined <code>subject</code> is between a defined
					<code>lowerBound</code> and <code>upperBound</code>. For example, the following predicate object
					asserts that the subject is greater than or equal to 10 and less than or equal
				to 99:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    ConditionExpression,
    ConditionExpressionPredicate,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">let</span> equalsExpressionPredicate: ConditionExpressionPredicate = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'Between'</span>,
    lowerBound: <span class="hljs-number">10</span>,
    upperBound: <span class="hljs-number">99</span>
};

<span class="hljs-comment">// you can also define an equality predicate with the `equals` helper method</span>
<span class="hljs-keyword">import</span> {between} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

equalsExpressionPredicate = between(<span class="hljs-number">10</span>, <span class="hljs-number">99</span>);

<span class="hljs-comment">// combine with a subject to create a valid condition expression</span>
<span class="hljs-keyword">const</span> equalsExpression: ConditionExpression = {
    ...equalsExpressionPredicate,
    subject: <span class="hljs-string">'foo'</span>
};
</code></pre>
				<p><code>lowerBound</code> and <code>upperBound</code> may both be an <a href="#attribute-paths">attribute path</a>,
					an <a href="#attribute-values">attribute value</a>, or another type. If the lattermost type
					is received, it will be serialized using the <code>@aws/dynamodb-auto-marshaller</code>
				package.</p>
				<h4 id="membership-expression-predicate"><code>Membership</code> expression predicate</h4>
				<p>Creates a condition which is true if the defined <code>subject</code> is equal to a member
					of a list of defined values. For example, the following predicate object asserts
				that the subject is one of <code>&#39;fizz&#39;</code>, <code>&#39;buzz&#39;</code>, or <code>&#39;fizzbuzz&#39;</code>:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    ConditionExpression,
    ConditionExpressionPredicate,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">let</span> equalsExpressionPredicate: ConditionExpressionPredicate = {
    <span class="hljs-keyword">type</span>: <span class="hljs-string">'Membership'</span>,
    values: [<span class="hljs-string">'fizz'</span>, <span class="hljs-string">'buzz'</span>, <span class="hljs-string">'fizzbuzz'</span>]
};

<span class="hljs-comment">// you can also define an equality predicate with the `equals` helper method</span>
<span class="hljs-keyword">import</span> {inList} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

equalsExpressionPredicate = inList(<span class="hljs-string">'fizz'</span>, <span class="hljs-string">'buzz'</span>, <span class="hljs-string">'fizzbuzz'</span>);

<span class="hljs-comment">// combine with a subject to create a valid condition expression</span>
<span class="hljs-keyword">const</span> equalsExpression: ConditionExpression = {
    ...equalsExpressionPredicate,
    subject: <span class="hljs-string">'foo'</span>
};
</code></pre>
				<p>Each value in the <code>values</code> array may be an <a href="#attribute-paths">attribute path</a>,
					an <a href="#attribute-values">attribute value</a>, or another type. If the lattermost type
					is received, it will be serialized using the <code>@aws/dynamodb-auto-marshaller</code>
				package.</p>
				<h3 id="serializing-condition-expressions">Serializing condition expressions</h3>
				<p>To serialize a condition expression, pass a <code>ConditionExpression</code> object and an
				instance of <code>ExpressionAttributes</code>.</p>
				<h2 id="expression-attributes">Expression attributes</h2>
				<p>Amazon DynamoDB expressions are serialized as strings with semantically
					important control characters and reserved words. The <code>ExpressionAttributes</code>
					object will escape both attribute names and attribute values for safe use in
					any expression. When a full DynamoDB request input is ready to be sent, you can
					retrieve a the <code>ExpressionAttributeNames</code> and <code>ExpressionAttributeValues</code> shapes
				to send alongside the input:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    AttributePath,
    AttributeValue,
    ExpressionAttributes,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;
<span class="hljs-keyword">const</span> DynamoDb = <span class="hljs-built_in">require</span>(<span class="hljs-string">'aws-sdk/clients/dynamodb'</span>);

<span class="hljs-keyword">const</span> attributes = <span class="hljs-keyword">new</span> ExpressionAttributes();

<span class="hljs-comment">// you can add a string attribute name</span>
<span class="hljs-keyword">const</span> escapedFoo = attributes.addName(<span class="hljs-string">'foo'</span>);
<span class="hljs-comment">// or a complex path</span>
<span class="hljs-keyword">const</span> escapedPath = attributes.addName(<span class="hljs-string">'bar.baz[3].snap.crackle.pop'</span>);
<span class="hljs-comment">// or an already parsed attribute path</span>
attributes.addName(<span class="hljs-keyword">new</span> AttributePath(<span class="hljs-string">'path.to.nested.field'</span>));

<span class="hljs-comment">// raw JavaScript values added will be converted to AttributeValue objects</span>
<span class="hljs-keyword">const</span> escapedRaw = attributes.addValue(<span class="hljs-number">42</span>);
<span class="hljs-comment">// already marshalled values must be wrapped in an AttributeValue object</span>
<span class="hljs-keyword">const</span> escapedMarshalled = attributes.addValue(<span class="hljs-keyword">new</span> AttributeValue({N: <span class="hljs-string">"42"</span>}));

<span class="hljs-keyword">const</span> client = <span class="hljs-keyword">new</span> DynamoDb();
client.query({
    TableName: <span class="hljs-string">'my_table'</span>,
    KeyConditionExpression: <span class="hljs-string">`<span class="hljs-subst">${escapedFoo}</span> = <span class="hljs-subst">${escapedRaw}</span> AND <span class="hljs-subst">${escapedPath}</span> = <span class="hljs-subst">${escapedMarshalled}</span>`</span>,
    ExpressionAttributeNames: attributes.names,
    ExpressionAttributeValues: attributes.values,
})
</code></pre>
				<h2 id="function-expressions">Function expressions</h2>
				<p>Function expressions represent named functions that DynamoDB will execute on
					your behalf. The first parameter passed to the <code>FunctionExpression</code> represents
					the function name and must be a string; all subsequent parameters represent
					arguments to pass to the function. These parameters may be instances of
					<code>AttributePath</code> (to have the function evaluate part of the DynamoDB document to
					which the function applies), <code>AttributeValue</code> (for already-marshalled
					AttributeValue objects), or arbitrary JavaScript values (these will be converted
				by the <code>@aws/dynamodb-auto-marshaller</code> package&#39;s <code>Marshaller</code>):</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    AttributePath,
    ExpressionAttributes,
    FunctionExpression,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">const</span> expr = <span class="hljs-keyword">new</span> FunctionExpression(
    <span class="hljs-string">'list_append'</span>, 
    <span class="hljs-keyword">new</span> AttributePath(<span class="hljs-string">'path.to.list'</span>),
    <span class="hljs-string">'foo'</span>
);
<span class="hljs-keyword">const</span> attributes = <span class="hljs-keyword">new</span> ExpressionAttributes();
<span class="hljs-comment">// serializes as 'list_append(#attr0.#attr1.#attr2, :val3)'</span>
<span class="hljs-keyword">const</span> serialized = expr.serialize(attributes);
<span class="hljs-built_in">console</span>.log(attributes.names); <span class="hljs-comment">// {'#attr0': 'path', '#attr1': 'to', '#attr2': 'list'}</span>
<span class="hljs-built_in">console</span>.log(attributes.values); <span class="hljs-comment">// {':val3': {S: 'foo'}}</span>
</code></pre>
				<h2 id="mathematical-expressions">Mathematical expressions</h2>
				<p>Mathematical expressions are used in the <code>SET</code> clause of update expressions to
				add or subtract numbers from attribute properties containing number values:</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {MathematicalExpression} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">const</span> expr = <span class="hljs-keyword">new</span> MathematicalExpression(<span class="hljs-string">'version'</span>, <span class="hljs-string">'+'</span>, <span class="hljs-number">1</span>);
</code></pre>
				<h2 id="projection-expressions">Projection Expressions</h2>
				<p>Projection expressions tell DynamoDB which attributes to include in fetched
					records returned by <code>GetItem</code>, <code>Query</code>, or <code>Scan</code> operations. This library uses
					<code>ProjectionExpression</code> as a type alias for an array of strings and
				<code>AttributePath</code> objects.</p>
				<h2 id="update-expressions">Update Expressions</h2>
				<p>Update expressions allow the partial, in place update of a record in DynamoDB.
					The expression may have up to four clauses, one containing directives to set
					values in the record, one containing directives to remove attributes from the
					record, one containing directives to add values to a set, and the last
				containing directives to delete values from a set.</p>
				<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> {
    AttributePath,
    FunctionExpression,
    UpdateExpression,
} <span class="hljs-keyword">from</span> <span class="hljs-string">'@aws/dynamodb-expressions'</span>;

<span class="hljs-keyword">const</span> expr = <span class="hljs-keyword">new</span> UpdateExpression();

<span class="hljs-comment">// set a value by providing its key and the desired value</span>
expr.set(<span class="hljs-string">'foo'</span>, <span class="hljs-string">'bar'</span>);
<span class="hljs-comment">// you may also set properties in nested maps and lists</span>
expr.set(
    <span class="hljs-string">'path.to.my.desired[2].property'</span>,
    <span class="hljs-keyword">new</span> FunctionExpression(
        <span class="hljs-string">'list_append'</span>,
        <span class="hljs-keyword">new</span> AttributePath(<span class="hljs-string">'path.to.my.desired[2].property'</span>),
        <span class="hljs-string">'baz'</span>   
    )
);

<span class="hljs-comment">// remove a value by providing its key or path</span>
expr.remove(<span class="hljs-string">'fizz.buzz.pop[0]'</span>);

<span class="hljs-comment">// add a value to a set</span>
expr.add(<span class="hljs-string">'string_set'</span>, <span class="hljs-string">'foo'</span>);

<span class="hljs-comment">// delete a value from the same set</span>
expr.delete(<span class="hljs-string">'string_set'</span>, <span class="hljs-string">'bar'</span>);
</code></pre>
			</div>
		</div>
		<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
			<nav class="tsd-navigation primary">
				<ul>
					<li class="globals  ">
						<a href="globals.html"><em>Globals</em></a>
					</li>
				</ul>
			</nav>
			<nav class="tsd-navigation secondary menu-sticky">
				<ul class="before-current">
					<li class=" tsd-kind-class">
						<a href="classes/attributepath.html" class="tsd-kind-icon">Attribute<wbr>Path</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/attributevalue.html" class="tsd-kind-icon">Attribute<wbr>Value</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/expressionattributes.html" class="tsd-kind-icon">Expression<wbr>Attributes</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/functionexpression.html" class="tsd-kind-icon">Function<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/mathematicalexpression.html" class="tsd-kind-icon">Mathematical<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-class">
						<a href="classes/updateexpression.html" class="tsd-kind-icon">Update<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/andexpression.html" class="tsd-kind-icon">And<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/attributebearingexpression.html" class="tsd-kind-icon">Attribute<wbr>Bearing<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/attributeexistspredicate.html" class="tsd-kind-icon">Attribute<wbr>Exists<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/attributename.html" class="tsd-kind-icon">Attribute<wbr>Name</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/attributenotexistspredicate.html" class="tsd-kind-icon">Attribute<wbr>Not<wbr>Exists<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/attributetypepredicate.html" class="tsd-kind-icon">Attribute<wbr>Type<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/basefunctionexpressionpredicate.html" class="tsd-kind-icon">Base<wbr>Function<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/beginswithpredicate.html" class="tsd-kind-icon">Begins<wbr>With<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/betweenexpressionpredicate.html" class="tsd-kind-icon">Between<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/binarycomparisonpredicate.html" class="tsd-kind-icon">Binary<wbr>Comparison<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/conditionexpressionsubject.html" class="tsd-kind-icon">Condition<wbr>Expression<wbr>Subject</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/containspredicate.html" class="tsd-kind-icon">Contains<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/equalityexpressionpredicate.html" class="tsd-kind-icon">Equality<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/greaterthanexpressionpredicate.html" class="tsd-kind-icon">Greater<wbr>Than<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/greaterthanorequaltoexpressionpredicate.html" class="tsd-kind-icon">Greater<wbr>Than<wbr>OrEqual<wbr>ToExpression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/inequalityexpressionpredicate.html" class="tsd-kind-icon">Inequality<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/lessthanexpressionpredicate.html" class="tsd-kind-icon">Less<wbr>Than<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/lessthanorequaltoexpressionpredicate.html" class="tsd-kind-icon">Less<wbr>Than<wbr>OrEqual<wbr>ToExpression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/listindex.html" class="tsd-kind-icon">List<wbr>Index</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/membershipexpressionpredicate.html" class="tsd-kind-icon">Membership<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/notexpression.html" class="tsd-kind-icon">Not<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-interface">
						<a href="interfaces/orexpression.html" class="tsd-kind-icon">Or<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#attributetype" class="tsd-kind-icon">Attribute<wbr>Type</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#comparisonoperand" class="tsd-kind-icon">Comparison<wbr>Operand</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#conditionexpression" class="tsd-kind-icon">Condition<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#conditionexpressionpredicate" class="tsd-kind-icon">Condition<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#functionexpressionpredicate" class="tsd-kind-icon">Function<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#mathematicalexpressionoperand" class="tsd-kind-icon">Mathematical<wbr>Expression<wbr>Operand</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#pathelement" class="tsd-kind-icon">Path<wbr>Element</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#projectionexpression" class="tsd-kind-icon">Projection<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-type-alias">
						<a href="globals.html#simpleconditionexpression" class="tsd-kind-icon">Simple<wbr>Condition<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#attributeexists" class="tsd-kind-icon">attribute<wbr>Exists</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#attributenotexists" class="tsd-kind-icon">attribute<wbr>Not<wbr>Exists</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#attributetype" class="tsd-kind-icon">attribute<wbr>Type</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#beginswith" class="tsd-kind-icon">begins<wbr>With</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#between" class="tsd-kind-icon">between</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#contains" class="tsd-kind-icon">contains</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#equals" class="tsd-kind-icon">equals</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#greaterthan" class="tsd-kind-icon">greater<wbr>Than</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#greaterthanorequalto" class="tsd-kind-icon">greater<wbr>Than<wbr>OrEqual<wbr>To</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#inlist" class="tsd-kind-icon">in<wbr>List</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#isconditionexpression" class="tsd-kind-icon">is<wbr>Condition<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#isconditionexpressionpredicate" class="tsd-kind-icon">is<wbr>Condition<wbr>Expression<wbr>Predicate</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#isconditionexpressionsubject" class="tsd-kind-icon">is<wbr>Condition<wbr>Expression<wbr>Subject</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#lessthan" class="tsd-kind-icon">less<wbr>Than</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#lessthanorequalto" class="tsd-kind-icon">less<wbr>Than<wbr>OrEqual<wbr>To</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#notequals" class="tsd-kind-icon">not<wbr>Equals</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#serializeconditionexpression" class="tsd-kind-icon">serialize<wbr>Condition<wbr>Expression</a>
					</li>
					<li class=" tsd-kind-function">
						<a href="globals.html#serializeprojectionexpression" class="tsd-kind-icon">serialize<wbr>Projection<wbr>Expression</a>
					</li>
				</ul>
			</nav>
		</div>
	</div>
</div>
<footer>
	<div class="container">
		<h2>Legend</h2>
		<div class="tsd-legend-group">
			<ul class="tsd-legend">
				<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
				<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
				<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
				<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
				<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
				<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
				<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
				<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
				<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
				<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
				<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
				<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
				<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
				<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
				<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
				<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
				<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
			</ul>
			<ul class="tsd-legend">
				<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
				<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
			</ul>
		</div>
	</div>
</footer>
<div class="overlay"></div>
<script src="assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="assets/js/search.js"><' + '/script>');</script>
</body>
</html>